package cn.org.zx.password.blh;

import java.util.HashMap;
import java.util.Map;

import cn.org.zx.common.commutils.StringUtils;
import cn.org.zx.common.dao.DBAccess;

public class PassWordBlh {		
	//密码修改初始化
	public Map<String, Object> getPassWordUpdateInit(Map mapData){
		Map<String, Object> mapReturn = new HashMap<String, Object>();
		
		String strSql = "";
		String struid =  StringUtils.toString(mapData.get("uid"));
		
		if(!struid.equals("")){			
			strSql="select * from tb_account where a_id ="+struid+"";
			mapReturn.putAll(DBAccess.queryOneRow(strSql));
		}
		
		return mapReturn;
	}
	
	//密码修改保存
	public Map<String, Object> getPassWordUpdateSave(Map mapData){
		Map<String, Object> mapReturn = new HashMap<String, Object>();
		String strSql = "";
		
		String straid = StringUtils.toString(mapData.get("hidaid"));
		String strOldPassWord = StringUtils.toString(mapData.get("txtoldPassword"));
		String strNewPassWord = StringUtils.toString(mapData.get("txtnewPassword"));
		
		if(!strNewPassWord.equals("") && !straid.equals("")){
			strSql = "update tb_account set a_password = '"+strNewPassWord+"' where a_password='"+strOldPassWord+"' and a_id = "+straid+"";
			mapReturn.put("mapReturn", DBAccess.update(strSql)==true?"success":"fail");
		}
		
		return mapReturn;
	}
}
